import BaseCommand from "@/core/Frame/BaseClass/BaseCommand"
import store from "@/store";
const PIE = window.PIE;

// 控制
class DrawControlCommand extends BaseCommand {
  viewer: any
  eventsManager: any
  widgetsManager: any;
  globeControl: any
  earthDraw: any;
  constructor(params: any) {
    super()
    this.viewer = params.viewer // 地球对象
    this.eventsManager = params.eventsManager // 发布订阅对象
    this.widgetsManager = params.widgetsManager // 组件管理对象
    this.globeControl = this.viewer.getGlobeControl()
    this.earthDraw = null;
  }
  execute(option: any): void {

  }
  // true代表功能可用，如果是false代表功能不可用
  isEnable(option: any): boolean {
    console.log(option);

    let currlayer = store.state.menu.selectLayer;
    if (option.name == '面' && currlayer.datasetType == 5) {
      option.enable == true;
      return true;
    } else if (option.name == '点' && currlayer.datasetType == 1) {
      option.enable == true;
      return true;
    } else if (option.name == '线' && currlayer.datasetType == 3) {
      option.enable == true;
      return true;
    } else {
      option.enable == false;
      return false;
    }
  }
}

export default DrawControlCommand